Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yamljs

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yamljs

Standalone JavaScript YAML 1.2 Parser & Encoder. Works under node.js and all major browsers. Also brings command line YAML/JSON conversion tools.

  • 0.2.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.1M
increased by8.79%
Maintainers
1
Weekly downloads
 
Created

What is yamljs?

The yamljs npm package is a library designed to parse YAML ('YAML Ain't Markup Language') strings and generate JavaScript objects, and vice versa. It provides an easy way to convert data between YAML, a human-friendly data serialization standard, and JavaScript objects. This can be particularly useful for configuration files, data exchange, and more, where YAML's readability and JavaScript's ubiquity are advantageous.

What are yamljs's main functionalities?

Parsing YAML to JavaScript Object

This feature allows you to convert a YAML string into a JavaScript object. It's particularly useful for reading configuration files or data represented in YAML format and using it within a JavaScript application.

const YAML = require('yamljs');
const yamlString = 'greeting: hello\nname: world';
const object = YAML.parse(yamlString);
console.log(object); // Output: { greeting: 'hello', name: 'world' }

Stringifying JavaScript Object to YAML

This feature enables the conversion of JavaScript objects into YAML strings. It's useful for creating configuration files or data exchange where YAML's human-readable format is preferred.

const YAML = require('yamljs');
const object = { greeting: 'hello', name: 'world' };
const yamlString = YAML.stringify(object, 4);
console.log(yamlString); // Output: 'greeting: hello\nname: world'

Other packages similar to yamljs

Keywords

FAQs

Package last updated on 20 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc